unit URelEtiquetaMalaCol;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBTables, QuickRpt, QRCtrls, ExtCtrls;

type
  TFRelEtiquetaMalaCol = class(TForm)
    QuickRep1: TQuickRep;
    QRBand2: TQRBand;
    QRDBText1: TQRDBText;
    QRelatorio: TQuery;
    qrlEndereco: TQRLabel;
    qrlBairro: TQRLabel;
    qrlCep: TQRLabel;
    qrlCidade: TQRLabel;
    procedure QRBand2BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FRelEtiquetaMalaCol: TFRelEtiquetaMalaCol;

implementation

{$R *.dfm}

procedure TFRelEtiquetaMalaCol.QRBand2BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
   if QRelatorio.FieldByName('TipoEndereco').AsString = '1' then
   begin
     //QRLNome.Caption:=QRelatorio.FieldByName('Pessoa').AsString;
     QRLEndereco.Caption:=QRelatorio.FieldByName('EnderecoResp').AsString;
     QRLBairro.Caption:=QRelatorio.FieldByName('BairroResp').AsString;
     QRLCidade.Caption:=QRelatorio.FieldByName('CidadeResp').AsString + ' - ' + QRelatorio.FieldByName('UfResp').AsString;
     QRLCep.Caption:='CEP : ' +QRelatorio.FieldByName('CepResp').AsString;
   end else begin
     //QRLNome.Caption:=QRelatorio.FieldByName('Pessoa').AsString;
     QRLEndereco.Caption:=QRelatorio.FieldByName('EnderecoPedi').AsString;
     QRLBairro.Caption:=QRelatorio.FieldByName('BairroPedi').AsString;
     QRLCidade.Caption:=QRelatorio.FieldByName('CidadePedi').AsString + ' - ' + QRelatorio.FieldByName('UfPedi').AsString;
     QRLCep.Caption:='CEP : ' +QRelatorio.FieldByName('CepPedi').AsString;
   end;
end;

end.
